Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classmap replacing change str_replace to regex #39

Merged

Conversation

BrianHenryIE
Copy link
Contributor

@BrianHenryIE BrianHenryIE commented Apr 9, 2020

For some reason, your code wasn't replacing references to the updated class names so I wrote the code myself before yours started working again. Odd.

Anyway, there was still an issue with doubled-up names, so I replaced the str_replace with a regex for more precise replacing.

After the classmap replacer processes each file and the Replacer->replacedClasses property is populated, the files are revisited and the changes implemented throughout.

e.g.

class BH_Google_Collection extends Google_Model implements Iterator, Countable

is now

class BH_Google_Collection extends BH_Google_Model implements Iterator, Countable

and

if (!class_exists('Google_Client')) {

is now

if (!class_exists('BH_Google_Client')) {

@BrianHenryIE BrianHenryIE changed the title Classmap replacing revists files and updates references Classmap replacing change str_replace to regex Apr 10, 2020
Assumes every line with "include" or "require" is including/requiring. Regex could be stricter
@coenjacobs
Copy link
Owner

Again, thank you so much for making these replace functions much more robust, @BrianHenryIE!

@danieliser
Copy link

This looks awesome.!!!

@BrianHenryIE BrianHenryIE deleted the more-thorough-classmap-replacing branch May 3, 2021 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants